from v2.Spider import Spider
from v2.headers_list import headers_list
from v2.ResultProcessor import DefaultResultProcessor
from v2.MySqlPipeline import MySqlPipeline
from v2.RequestItem import RequestItem


if __name__ == '__main__':
    request_items = []

    for i in range(1, 10):
        request_items.append(RequestItem(url='https://m.weibo.cn/api/comments/show',
                                         params={'id': '4620209346582917', 'page': str(i)}, timeout=3))

    spider = Spider(request_items=request_items,
                    pipeline=MySqlPipeline(),
                    result_processor=DefaultResultProcessor(),
                    headers_list=headers_list)
    spider.run()